﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DatabaseCompare.Model
{

    /// <summary>
    /// 视图信息.
    /// </summary>
    public class ViewInfo : CompareAbleWithSubList<ColumnInfo>, ICloneable
    {
        /// <summary>
        /// 创建视图的 SQL
        /// </summary>
        public string CreateViewSQL { set; get; }


        #region ICloneable 成员

        public object Clone()
        {
            // 浅层克隆,
            ViewInfo newTableInfo = this.MemberwiseClone() as ViewInfo;

            // 重新克隆 列信息.
            if (newTableInfo.SubList != null)
            {

                newTableInfo.SubList = new List<ColumnInfo>();

                foreach (ColumnInfo col in this.SubList)
                {
                    newTableInfo.SubList.Add(col.Clone() as ColumnInfo);
                }
            }

            // 返回.
            return newTableInfo;
        }

        #endregion


    }

}
